//
//  UserCouponResult.swift
//  ShopIOS
//
//  Created by Apple on 2019/8/13.
//  Copyright © 2019 Apple. All rights reserved.
//

import Foundation
import SwiftyJSON

struct UserCouponResult {
    var UserCount: Int = 0
    var Success: String?
    var Coupon = [UserCoupon]()
    var NoUseCount: Int = 0
    
    init(json: JSON) {
        UserCount = json["UserCount"].intValue
        Success = json["Success"].stringValue
        Coupon = json["Coupon"].arrayValue.compactMap({ UserCoupon(json: $0)})
        NoUseCount = json["NoUseCount"].intValue
    }
}

struct UserCouponVShop {
    var VShopLogo: String?
    var VShopId: Int = 0
    
    init(json: JSON) {
        VShopLogo = json["VShopLogo"].stringValue
        VShopId = json["VShopId"].intValue
    }
}

struct UserCoupon {
    var PerMax: Int = 0
    var CreateTime: String?
    var Price: Int = 0
    var ShopId: Int = 0
    var VShop: UserCouponVShop?
    var OrderAmount: Int = 0
    var CouponId: Int = 0
    var UserId: Int = 0
    var EndTime: String?
    var StartTime: String?
    var ShopName: String?
    var UseTime: String?
    var Num: Int = 0
    var CouponName: String?
    var UseStatus: Int = 0
    
    init(json: JSON) {
        PerMax = json["PerMax"].intValue
        CreateTime = json["CreateTime"].stringValue
        Price = json["Price"].intValue
        ShopId = json["ShopId"].intValue
        VShop = UserCouponVShop(json: json["VShop"])
        OrderAmount = json["OrderAmount"].intValue
        CouponId = json["CouponId"].intValue
        UserId = json["UserId"].intValue
        EndTime = json["EndTime"].stringValue
        StartTime = json["StartTime"].stringValue
        ShopName = json["ShopName"].stringValue
        UseTime = json["UseTime"].stringValue
        Num = json["Num"].intValue
        CouponName = json["CouponName"].stringValue
        UseStatus = json["UseStatus"].intValue
    }
}
